#include <string.h>

#include "player.h"


void
Player::RandomStats()
{


}

void
Player::SetName(const char * n)
{
	if (name) delete [] name;
	name = new char[strlen(n)+1];
	strcpy(name,n);
}

void
Player::SetStat(Stat s, uint8 c, uint8 t, uint8 b)
{
	switch(s)
	{
	case STR:
		str[curr] = c; str[bonus] = b; str[temp] = t;
		break;
	case DEX:
		dex[curr] = c; dex[bonus] = b; dex[temp] = t;
		break;
	case CON:
		con[curr] = c; con[bonus] = b; con[temp] = t;
		break;
	case INT:
		intl[curr] = c; intl[bonus] = b; intl[temp] = t;
		break;
	case SPI:
		spi[curr] = c; spi[bonus] = b; spi[temp] = t;
		break;
	}

}

uint8
Player::GetStat(Stat s, State st)
{
	switch(s)
	{
	case STR:
		return str[st];
		break;
	case DEX:
		return dex[st];
		break;
	case CON:
		return con[st];
		break;
	case INT:
		return intl[st];
		break;
	case SPI:
		return spi[st];
		break;
	}
	return 0;
}

void
Player::PrintPrimaryStats()
{
	

}

void
Player::PrintStat(uint8 * s)
{/*
	spi << "[";
	for (uint8 i = 0; i < *s; i++)
		spi << "|";
	for (uint8 i = *s; i < 25; i++)
		spi << " ";
	spi << "]" << "\n";
*/
}


Player::Player()
{
	// Set everything to default
	str[curr] = str[temp] = DEFAULT_STAT_BASE; str[bonus] = 0;
	dex[curr] = dex[temp] = DEFAULT_STAT_BASE; dex[bonus] = 0;
	con[curr] = con[temp] = DEFAULT_STAT_BASE; con[bonus] = 0;
	intl[curr] = intl[temp] = DEFAULT_STAT_BASE; intl[bonus] = 0;
	spi[curr] = spi[temp] = DEFAULT_STAT_BASE; spi[bonus] = 0;

	xp = 0;
	hp = DEFAULT_STAT_BASE;
	def[curr] = def[temp] = DEFAULT_STAT_BASE; def[bonus] = 0;
	initiative = 0;
}

Player::~Player()
{
	if (name) delete [] name;
}
